package com.k8.rpc.invoke;

import com.k8.rpc.Node;
import com.k8.rpc.RpcException;
import com.k8.rpc.invoke.invocation.Invocation;
import com.k8.rpc.result.Result;


public interface Invoker<T> extends Node {

    /**
     * get service interface.
     *
     * @return service interface.
     */
    Class<T> getInterface();

    T getTarget();

    /**
     * invoke.
     *
     * @param {@link Invocation}
     * @return Result
     * @throws RpcException
     */
    Result<?> invoke(Invocation invocation) throws Throwable;

    default void setAvailable(boolean b) {
    }
}
